/*
    This file is part of Lua Invoke.
    Copyright 2005-2007 Rafael de Oliveira Jannone <rafael@jannone.org>

    Lua Invoke is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/* test for module loading */

#ifdef WIN32
	#include "port_win32.h"
	#define dLuaInvokeLib "luainvoke.dll"
#else
	#include <dlfcn.h>
	#define dLuaInvokeLib "luainvoke.so"
#endif
#include <stdio.h>

int main()
{
	const char* error = NULL;
	void* handle = dlopen(dLuaInvokeLib, RTLD_NOW);
	if (error = dlerror()) {
		printf("error: %s\n", error);
		return 1;
	}

	void* import = dlsym(handle, "luaLM_import");
	if (error = dlerror()) {
		printf("error: %s\n", error);
		return 1;
	}

	dlclose(handle);	

	return 0;
}
